<?php

/**
 * This is the model class for table "area_of_safe_refuge".
 *
 * The followings are the available columns in table 'area_of_safe_refuge':
 * @property integer $id
 * @property integer $provided
 * @property string $type
 * @property string $location
 * @property integer $enclosure_provided
 * @property string $ep_construction
 * @property integer $fire_door_provided
 * @property string $fdp_width
 * @property string $units_of_measurement_in_width
 * @property string $fire_door_construction
 * @property integer $door_equipped_with_self_closing_device
 * @property integer $door_with_proper_rating
 * @property integer $door_provided_with_vision_panel
 * @property string $if_yes_made_of
 * @property integer $door_swing_in_the_direction_of_exit_travel
 * @property integer $exit_detail_id
 *
 * The followings are the available model relations:
 * @property ExitDetail $exitDetail
 */
class AreaOfSafeRefuge extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return AreaOfSafeRefuge the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
	const a = "Interior";
const b ="Exterior";
public function getType(){
return array(
self::a=>"Interior",
self::b=>"Exterior"
);


}

const f = "Foot";
const g = "Inches";

public function getMeasurement(){
return array(
self::f=>"Foot",
self::g=>"Inches"

);

}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'area_of_safe_refuge';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('exit_detail_id', 'required'),
			array('provided, enclosure_provided, fire_door_provided, door_equipped_with_self_closing_device, door_with_proper_rating, door_provided_with_vision_panel, door_swing_in_the_direction_of_exit_travel, exit_detail_id', 'numerical', 'integerOnly'=>true),
			array('type', 'length', 'max'=>8),
			array('fdp_width', 'length', 'max'=>11),
			array('units_of_measurement_in_width', 'length', 'max'=>6),
			array('location, ep_construction, fire_door_construction, if_yes_made_of', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, provided, type, location, enclosure_provided, ep_construction, fire_door_provided, fdp_width, units_of_measurement_in_width, fire_door_construction, door_equipped_with_self_closing_device, door_with_proper_rating, door_provided_with_vision_panel, if_yes_made_of, door_swing_in_the_direction_of_exit_travel, exit_detail_id', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'exitDetail' => array(self::BELONGS_TO, 'ExitDetail', 'exit_detail_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'provided' => 'Provided',
			'type' => 'Type',
			'location' => 'Location',
			'enclosure_provided' => 'Enclosure Provided',
			'ep_construction' => 'Ep Construction',
			'fire_door_provided' => 'Fire Door Provided',
			'fdp_width' => 'Fdp Width',
			'units_of_measurement_in_width' => 'Units Of Measurement In Width',
			'fire_door_construction' => 'Fire Door Construction',
			'door_equipped_with_self_closing_device' => 'Door Equipped With Self Closing Device',
			'door_with_proper_rating' => 'Door With Proper Rating',
			'door_provided_with_vision_panel' => 'Door Provided With Vision Panel',
			'if_yes_made_of' => 'If Yes Made Of',
			'door_swing_in_the_direction_of_exit_travel' => 'Door Swing In The Direction Of Exit Travel',
			'exit_detail_id' => 'Exit Detail',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('provided',$this->provided);
		$criteria->compare('type',$this->type,true);
		$criteria->compare('location',$this->location,true);
		$criteria->compare('enclosure_provided',$this->enclosure_provided);
		$criteria->compare('ep_construction',$this->ep_construction,true);
		$criteria->compare('fire_door_provided',$this->fire_door_provided);
		$criteria->compare('fdp_width',$this->fdp_width,true);
		$criteria->compare('units_of_measurement_in_width',$this->units_of_measurement_in_width,true);
		$criteria->compare('fire_door_construction',$this->fire_door_construction,true);
		$criteria->compare('door_equipped_with_self_closing_device',$this->door_equipped_with_self_closing_device);
		$criteria->compare('door_with_proper_rating',$this->door_with_proper_rating);
		$criteria->compare('door_provided_with_vision_panel',$this->door_provided_with_vision_panel);
		$criteria->compare('if_yes_made_of',$this->if_yes_made_of,true);
		$criteria->compare('door_swing_in_the_direction_of_exit_travel',$this->door_swing_in_the_direction_of_exit_travel);
		$criteria->compare('exit_detail_id',$this->exit_detail_id);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}